package org.example.controller;

import org.apache.rocketmq.client.producer.SendResult;
import org.example.domain.Result;
import org.example.mq.MqProducterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @FileName TestMQController
 * @Description
 * @Author coderfun
 * @selfDesc coding in fun
 * @date 2024-11-06
 **/
@RestController
@RequestMapping("/rocketmq")
public class TestMQController {

    @Autowired
    private MqProducterService mqProducerService;

    @GetMapping("/send")
    public void send() {
        mqProducerService.send("user");
    }

    @GetMapping("/sendTag")
    public Result<SendResult> sendTag() {
        SendResult sendResult = mqProducerService.sendTagMsg("带有tag的字符消息");
        return Result.success(sendResult);
    }
}

